<%@page contentType="text/html; charset=utf-8"%>
<%@ include file="../inc/TagLibs.jsp"%>
<c:set var="pageTitle" value="业务单审核" />
<%@ include file="../inc/Title.jsp"%>
<head>
<link rel="stylesheet" type="text/css" href="/css/base.css" />
<link href="/css/Query.css" rel="stylesheet" type="text/css">
<script src="/js/QueryList.js"></script>
<script src="/js/popup_ext.js"></script>
<script language="javascript">
	function doShow(id){
		var url="/business/BusinessBillInfoForExamine.ihtm?id="+id;
		ShowIframe("业务单审核",url,1024,500,"refreshWin()",900,600);
	}
	function refreshWin(){
		if(popRetVal!=null){
			window.location=window.location;
		}
	}
	function doExamine(id){
		ShowConfirm('确认框','确定审核通过吗？',340,80,"doExamineCallBack('"+id+"')");
	}
	function doExamineCallBack(id){
		if(popRetVal!=null){
			var url="/business/BusinessBillExamine.ihtm?id_str="+id+"&flag=MULTI_EXA";
			ShowIframe("业务单审核",url,200,200,"refreshWin()");
		}
	}
	function doMutiExamine(){
		var ob_arr = document.getElementsByName("query_checkbox");
		var str="";
		for (i=0;i<ob_arr.length;i++){
			if ((ob_arr[i].checked == true)){
				if(str!=""){
					str=str+";";
				}
				str = str+ob_arr[i].value;
			}
		}
		
		if(str!=""){
			doExamine(str);
		}else{
			ShowAlert('提示框','请选择要审核通过的业务单',200,100);
		}
	}
	function doSearch(){
		var searchKey=encodeURIComponent(document.getElementById("search_key").value.trim());
		var costType=document.getElementById("cost_type").value;
		var tsId=document.getElementById("ts_id").value;
		window.location="/business/BusinessBillListForExamine.ihtm?ts_id="+tsId+"&cost_type="+costType+"&search_key="+searchKey;
	}
	function doGo(pageIndex){
		var searchKey=encodeURIComponent("${searchKey}");
		window.location="/business/BusinessBillListForExamine.ihtm?ts_id=${tsId}&cost_type=${costType}&search_key="+searchKey+"&current_page="+pageIndex;
	}
	function doJump(pageIndex){
		if(window.event.keyCode==13){
			doGo(pageIndex);
		}
	}
	function DoubleClick(it){
		var ob_arr = document.getElementsByName("query_checkbox");
		var str="";
		if(ob_arr.length>=it.getAttribute("index")){
			str=ob_arr[it.getAttribute("index")-1].value;
		}
		
		if(str==""){
			return;
		}
		doShow(str);
	}
	function doCancel(){
		window.close();
	}
	function doInit(){
		//Window_Onload();
		document.getElementById("search_key").focus();
	}
	function checkSearchKey(){
		if(window.event.keyCode==13){
			doSearch();
		}
	}
	function showSmsSubscribe(){
		<c:if test="${currentUser.user.userType==1 || fn:indexOf(currentUser.privs,';SMS_SUBS;')!=-1}">
		showWin(520,640,'/sms/SmsSubscribe.ihtm');
		</c:if>
		<c:if test="${currentUser.user.userType!=1 && fn:indexOf(currentUser.privs,';SMS_SUBS;')==-1}">
		ShowAlert('提示框','对不起，您还没有短信订阅设置权限。',200,100);
		</c:if>
	}
	function doPrint(id,type){
		showWin(900,600,"/business/BusinessBillPrint.ihtm?id="+id+"&type="+type);
	}
	function showPrintSelect(id){
		ShowIframeNoScroll("选择打印类型","/business/BusinessBillPrintSelect.ihtm",240,280,"showPrintSelectCallBack("+id+")");
	}
	function showPrintSelectCallBack(id){
		if(popRetVal!=null){
			doPrint(id,popRetVal);
		}
	}
</script>
</head>
<body oncontextmenu="return false" onLoad="doInit();" class="sheet" style="text-align:center">
<div class="sheet-main" style="width:860px;text-align:left;margin:auto">
  <div class="sheet-top">
    <div class="content">
      <h2>业务单审核</h2>
      <p>在这里可以对所有未审核的业务单进行审核操作，可以直接修改业务单</p>
    </div>
  </div>
  <div class="sheet-list">
    <div class="search-business">
      <div class="content">
        <table width="748">
          <tbody>
            <tr>
				<td>&nbsp;
              		<c:if test="${currentUser.user.userType==1 || fn:indexOf(currentUser.privs,';SMS_SUBS;')!=-1}">
					<!-- <a href="javascript:showSmsSubscribe();" title="设置有新业务单需要审核时，系统自动发消息提醒指定接收人员。">设置消息提醒</a> -->
					</c:if>
				</td>
				<td width="500" align="right">
	              <input type="text" class="TextBox" id="search_key" name="search_key" onKeyUp="checkSearchKey();" style="width:100px" value="${searchKey}" title="以客户名称、客户拼音字头、摘要、业务单号进行模糊查询">
	              <select name='cost_type' id="cost_type">
	              	<option value="">==全部==</option>
	              	<option value="NOT_ZERO" <c:if test="${costType=='NOT_ZERO'}">selected</c:if>>金额不为0</option>
	              	<option value="ZERO" <c:if test="${costType=='ZERO'}">selected</c:if>>金额为0</option>
	              </select>
	              <select name='ts_id' id="ts_id">
					<option value="0">==请选择账套==</option>
					<c:forEach var="item" items="${tsList}">
					<option value="${item.id}" <c:if test="${tsId==item.id}">selected</c:if>>${item.title}</option>
					</c:forEach>
		  		  </select>
	              <input type="button" class="buttom search-but" value=" 查 询" onClick="doSearch();" title="以客户名称、客户拼音字头、摘要、业务单号进行模糊查询">
	              <input type="button" class="buttom  search-audit" value=" 审核通过" onClick="doMutiExamine();">
				</td>
            </tr>    
           </tbody>      
        </table>
      </div>
	  <%@include file="../inc/AlertMsg.jsp"%>
	  <div class="table-list">
        <table width="100%">      
				<tr >
					<th width="14"><input type="checkbox" onClick="javascript:checkall(this);"></th>
					<th  width="16%">单号</th>
					<th  width="10%">订货日期</th>
					<th  width="16%">订货单位</th>
					<th  width="16%">摘要</th>
					<th  width="10%">金额</th>
					<th  width="10%">交货日期</th>
					<th  width="14%">跟单员</th>
					<th  width="8%">操作</th>
				</tr>
				<c:forEach var="item" items="${qr.list}" varStatus="i">
					<c:if test="${(i.index mod 2)==0}"><c:set var="trClass" value="query_list_data_tr1" /></c:if>
					<c:if test="${(i.index mod 2)!=0}"><c:set var="trClass" value="query_list_data_tr2" /></c:if>
					<tr class="${trClass}" index="${i.index+1}" style='cursor:pointer;' ondblclick='javascript:DoubleClick(this)' onClick='javascript:ClickCheck(this,true)' onmouseout='javascript:mouseout(this)' onmouseover='javascript:mouseover(this)'>
						<td ><input type="checkbox" onClick="javascript:ClickCheck(this,true);" name='query_checkbox' value="${item[0].id}"></td>
						<td>
							<c:if test="${item[0].sourType=='ONLINE'}"><img src="/images/earth.png" title="网络自助下单"></c:if>
							${item[0].billCode}
						</td>
						<td><fmt:formatDate value="${item[0].orderDate}" pattern="yyyy-MM-dd"/></td>
						<td>${item[1]}<c:if test="${item[0].linkman!=null && item[0].linkman!=''}">(${item[0].linkman})</c:if></td>
						<td>${item[0].content}</td>
						<td><commonTag:parseBigDecimal source="${item[0].cost}" /></td>
						<td>
							<c:if test="${item[0].deliverDate!=null}">
							<fmt:formatDate value="${item[0].deliverDate}" pattern="yyyy-MM-dd"/>
							</c:if>
						</td>
						<td>${item[0].followerNameStr}</td>
						<td>
							<a href="javascript:doExamine('${item[0].id}');">审核通过</a>
							<br>
							<a href="javascript:doShow('${item[0].id}');">查看</a>
							<a href="javascript:showPrintSelect('${item[0].id}');">打印</a>
						</td>
					</tr>
				</c:forEach>
			</table>
			<%@include file="../inc/Pages.jsp"%>
      </div>
    </div>
  </div>
</div>
</body>
</html>
